﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class HierarchyMenu : EditorWindow
{
    [MenuItem("GameObject/计算子节点个数", false, -1)]
    private static void CalcChildCount()
    {
        if (Selection.activeGameObject != null)
            Debug.Log("子节点个数 : " + (Selection.activeGameObject.GetComponentsInChildren<Transform>().Length - 1));
        else
            Debug.Log("没有选择GameObject");
    }
}
